/*
 * MIT License
 *
 * Copyright (c) 2024-2048 冰羽
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

package cn.star.framework.dev.entity;

import cn.star.framework.entity.AbstractIdEntity;
import java.sql.JDBCType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Lob;
import javax.persistence.Table;
import lombok.Data;
import org.hibernate.annotations.Comment;

/**
 * MetaTableColumn<br>
 *
 * @author zhaoweiping
 *     <p style='color: red'>Created on 2024-09-23 11:06:00
 * @since 3.0.0
 */
@Data
@Entity
@Table(name = "sys_meta_table_column")
@org.hibernate.annotations.Table(appliesTo = "sys_meta_table_column", comment = "关系型数据库表字段")
public class MetaTableColumn extends AbstractIdEntity {

  @Column(name = "fk_table_id_", length = 32, nullable = false)
  @Comment("外键")
  private String tableId;

  @Column(name = "table_name_", length = 64, nullable = false)
  @Comment("表名")
  private String tableName;

  @Column(name = "name_", length = 64, nullable = false)
  @Comment("名称")
  private String name;

  @Column(name = "comment_")
  @Comment("注释")
  private String comment;

  @Column(name = "length_", length = 11)
  @Comment("长度")
  private Integer length = 255;

  @Column(name = "precision_", length = 11)
  @Comment("precision")
  private Integer precision = 0;

  @Column(name = "scale_", length = 11)
  @Comment("scale")
  private Integer scale = 0;

  @Column(name = "unique_", length = 8)
  @Comment("是否唯一")
  private Boolean unique = false;

  @Column(name = "nullable_", length = 8)
  @Comment("是否为空")
  private Boolean nullable = true;

  @Column(name = "primary_", length = 8)
  @Comment("是否主键")
  private Boolean primary = false;

  @Column(name = "default_value_")
  @Comment("默认值")
  private String defaultValue;

  @Column(name = "sql_type_", length = 32)
  @Comment("SqlType")
  private String sqlType;

  @Column(name = "sql_type_code_", length = 11)
  @Comment("SqlTypeCode")
  private Integer sqlTypeCode;

  @Column(name = "jdbc_type_", length = 32)
  @Comment("类型")
  private JDBCType jdbcType;

  @Column(name = "order_", length = 11)
  @Comment("顺序")
  private Integer order;

  @Lob
  @Column(name = "extra_")
  @Comment("注释")
  private String extra;
}
